﻿using FriendAnalyzer.Infrastructure.Facebook.Tests.Mocks;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using System.Linq;

namespace FriendAnalyzer.Infrastructure.Facebook.Tests.Repositories
{
    [TestClass]
    public class FriendRepositoryTests
    {
        [TestMethod]
        public async void ShouldAggregateUserEventData()
        {
            var repo = new MockFriendRepository();

            var api = new FriendsAPI(repo);

            var aggregate = await api.AggregateFriendsDataAsync();

            var checkEventsCount = aggregate.All(i => i.Events.Count == 1);

            Assert.AreEqual(false, checkEventsCount);
        }

        [TestMethod]
        public async void ShouldAggregateUserLikeData()
        {
            var repo = new MockFriendRepository();

            var api = new FriendsAPI(repo);

            var aggregate = await api.AggregateFriendsDataAsync();

            var checkLikeCount = aggregate.All(i => i.Likes.Count == 1);

            Assert.AreEqual(false, checkLikeCount);
        }

        [TestMethod]
        public async void ShouldAggregateUserGroupData()
        {
            var repo = new MockFriendRepository();

            var api = new FriendsAPI(repo);

            var aggregate = await api.AggregateFriendsDataAsync();

            var checkLikeCount = aggregate.All(i => i.Groups.Count == 1);

            Assert.AreEqual(false, checkLikeCount);
        }

        [TestMethod]
        public async void ShouldAggregateUserCheckinData()
        {
            var repo = new MockFriendRepository();

            var api = new FriendsAPI(repo);

            var aggregate = await api.AggregateFriendsDataAsync();

            var checkLikeCount = aggregate.All(i => i.CheckIns.Count == 1);

            Assert.AreEqual(false, checkLikeCount);
        }
    }
}
